#include "libpluginaso/combinatory_policy_simp_imp.h"

//----------Empty------------
bool EmptyCombinatory::combine(const Avs& /*elements*/, CombinationObserver* /*observer*/, CombinationStatus& status)
{
    status.status = Success;
    status.name = get_name();
    return true;
}

//---------List--------------
bool ListCombinatory::combine(const Avs& elements, CombinationObserver* observer, CombinationStatus& status)
{
    const bool isEmpty(elements.size() == 0);
    status.name = get_name();
    bool continueComb(true);
    if (!isEmpty)
    {
        mili::CAutonomousIterator<Avs> avit(elements);
        while (!avit.end() && continueComb) //! mientras alla elementos y el obs quiera más.
        {
            Avs aux;
            mili::insert_into(aux, *avit);
            continueComb = observer->update(&aux);
            ++avit;
        }
        status.status = Success;
    }
    else
        status.status = Error;
    return continueComb;
}
